package morenoapp.model.impl;

import morenoapp.model.data.MorenoQuestionFace;
import morenoapp.model.data.MorenoQuestionItemFace;
import java.io.Serializable;
import morenoapp.model.data.MorenoRespondentFace;
import morenoapp.util.MorenoUtil;

/**
 *
 * @author dmitry.mamonov
 */
class MorenoQuestionItemImpl extends MorenoModelObject implements Serializable, MorenoQuestionItemFace {
    private static final long serialVersionUID = 1L;
    private MorenoQuestionFace question;
    private int itemNumber;

    MorenoQuestionItemImpl(MorenoQuestionImpl _question, int _itemNumber) {
        super(_question.getModel());
        this.question = _question;
        this.itemNumber = _itemNumber;
    }

    @Override
    public MorenoQuestionFace getQuestion() {
        return this.question;
    }

    @Override
    public int getPreferencesCountForRespondent(MorenoRespondentFace _respondent) {
        throw new UnsupportedOperationException("Not supported yet."); //NOI18N
    }

    @Override
    public int getItemNumber() {
        return this.itemNumber;
    }

    @Override
    public int getItemIndex() {
        return getItemNumber() - 1;
    }

    @Override
    public String toHtmlString() {
        return "<b>" + MorenoUtil.wrapTextWithColor( //NOI18N
                question.getColor(),
                getItemNumber() + ". " + getQuestion().
                getMarker()) + "</b>"; //NOI18N

    }
}
